﻿using System;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;

namespace KiraSh.ResumeTracker
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (!RunUninstall())
            {
                Directory.CreateDirectory(PathHelper.MapCombine(""));
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new frmMainWindow());
            }
        }

        public static bool RunUninstall()
        {
            string [] arguments = Environment.GetCommandLineArgs();
            foreach (string argument in arguments)
            {
                if (argument.Split('=')[0].ToLower() == "/u")
                {
                    string guid = argument.Split('=')[1];
                    string path = Environment.GetFolderPath(Environment.SpecialFolder.System);
                    ProcessStartInfo si = new ProcessStartInfo(Path.Combine(path,"msiexec.exe"),"/x "+guid);
                    Process.Start(si);
                    Application.Exit();
                    return true;
                }
            }
            return false;
        }
    }
}
